package com.HelloSpring.helloworld;
//package com.HelloSpring.DI;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import com.HelloSpring.DI.*;

/**
 * Hello world!
 *
 */
public class App {
	public static void main(String[] args) {
		AbstractApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
		HelloWorld obj = (HelloWorld) context.getBean("HelloWorld");
		obj.getMessage();
		obj.getMessage1();
		obj.getMessage2();

		HelloChina china = (HelloChina) context.getBean("HelloChina");
		china.getMessage();
		china.getMessage1();
		china.getMessage2();

		TextEditor te = (TextEditor) context.getBean("textEditor");
		te.spellCheck();

		Document doc = (Document) context.getBean("Document");
		doc.write("asdf");

		JavaCollection javaCollection = (JavaCollection) context.getBean("javaCollection");
		javaCollection.getAddressList();
		javaCollection.getAddressSet();
		javaCollection.getAddressMap();
		javaCollection.getAddressProp();

		context.registerShutdownHook();
		((ConfigurableApplicationContext) context).close();
	}
}
